package com.coo.display
{
	import flash.display.Graphics;

	public class RoundRect extends Baseshape
	{
		
		private var _width:Number;
		private var _height:Number;
		private var _ew:Number;
		private var _eh:Number;
		
		public function RoundRect( width:Number = 100, 
		                                    height:Number = 100,
		                                    ew:Number = 20,
		                                    eh:Number = 20)
		{
			super();
			
			this._width = width;
			this._height = height;
			this._ew = ew;
			this._eh = eh;
			
			this.drawMain();
			
		}
		
		override protected function drawMain(): void
		{
			var g:Graphics = this.graphics;
			
			g.clear();
			
			g.lineStyle( this.lineThickness,this.lineColor,this.lineAlpha,true );
			g.beginFill( this.fillColor, this.fillAlpha );
			g.drawRoundRect( 0,0,this._width,this._height,this._ew,this._eh );
			g.endFill();
			
		}
		
		public function get ew(): uint
		{
			return _ew;
		}
		
		public function set ew( value:uint ): void
		{
			this._ew = value;
			this.drawMain();
		}
		
		public function get eh():uint
		{
			return _eh
		}
		
		public function set eh( value: uint ): void
		{
			this._eh = value;
			this.drawMain();
		}
		
		// 라운드렉드 에서 width를 늘려 버리면 sprite에 있는 width가 늘어나기 때문에(ew eh가 같이 늘어남)
		// 내가 정의한  width를 쓰겠다고
		// 재정의를 해줘야 한다
		
		override public function set width(value:Number):void
		{
			this._width = value;
			this.drawMain();
		}
		
		override public function set height(value:Number):void
		{
			this._height = value;
			this.drawMain();
		}
		
		
	}
}